Load the counts from GSNAP counts

setwd("/Users/stajich/projects/A_fumigatus/Afum_RNASeq_eefA")
countdata <- read.table("reports/Hypoxia.Af293.gsnap_reads.nostrand.tab",
                        header=TRUE, row.names=1)
colnames(countdata) <- gsub("\\.gsnap_Afum_Af293\\.[sb]am$", "", colnames(countdata))
colnames(countdata) <- gsub("aln\\.", "", colnames(countdata))
countdata <- countdata[ ,6:ncol(countdata)]
countdata <- as.matrix(countdata)
#head(countdata)

samples <- read.csv("samples.csv",header=TRUE)
exprnames <- do.call(paste,c(samples[c("Strain","Condition","Replicate")],sep="_"))
exprnames <- sub(".([123])$",".r\\1",exprnames,perl=TRUE)

# check that experimental columns match in order
all(exprnames %in% colnames(countdata))
## [1] TRUE
all(exprnames == colnames(countdata))
## [1] FALSE
# reorder the columns anyways... in case data change along the way
countdata <- countdata[,exprnames]
all(exprnames == colnames(countdata))
## [1] TRUE

prepare the DESeq objects and analyses

Load a table with the genotype by replicate by treatment information

## [1] 10130
## [1] 9932
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## rlog() may take a few minutes with 30 or more samples,
## vst() is a much faster transformation
##            AF293_Normoxia.r1 AF293_Normoxia.r2 AF293_Normoxia.r3
## Afu8g05820          5.541035          5.918401          5.631651
## Afu1g00220          9.524851          9.188179          9.332928
## Afu1g11050          5.194070          5.233264          5.395223
##            AF293_Hypoxia.r1 AF293_Hypoxia.r2 AF293_Hypoxia.r3
## Afu8g05820         4.965843         5.235733         5.370264
## Afu1g00220         9.429123         9.305190         9.127422
## Afu1g11050         5.927175         5.378108         5.322468
##            Delta_eefA_AF293_Normoxia.r1 Delta_eefA_AF293_Normoxia.r2
## Afu8g05820                     5.813727                     5.949488
## Afu1g00220                     9.624740                     9.761400
## Afu1g11050                     5.058145                     5.156440
##            Delta_eefA_AF293_Normoxia.r3 Delta_eefA_AF293_Hypoxia.r1
## Afu8g05820                     5.912595                    5.004012
## Afu1g00220                     9.705158                    9.404233
## Afu1g11050                     4.973572                    5.607735
##            Delta_eefA_AF293_Hypoxia.r2 Delta_eefA_AF293_Hypoxia.r3
## Afu8g05820                    5.709117                    5.725944
## Afu1g00220                    9.193827                    9.381498
## Afu1g11050                    5.434107                    6.065524
##            eefA_OE_Normoxia.r1 eefA_OE_Normoxia.r2 eefA_OE_Normoxia.r3
## Afu8g05820            5.935578            5.703076            6.176832
## Afu1g00220            8.794052            8.748906            8.686071
## Afu1g11050            5.136203            5.106237            5.022830
##            eefA_OE_Hypoxia.r1 eefA_OE_Hypoxia.r2 eefA_OE_Hypoxia.r3
## Afu8g05820           4.956510           4.556240           4.878254
## Afu1g00220           9.357518           9.324668           9.067162
## Afu1g11050           5.695331           4.973537           5.440382
##            eefA_REV_Normoxia.r1 eefA_REV_Normoxia.r2 eefA_REV_Normoxia.r3
## Afu8g05820             5.838379             5.743655             5.788968
## Afu1g00220             8.594044             8.553587             8.527232
## Afu1g11050             5.016668             5.126639             4.570710
##            eefA_REV_Hypoxia.r1 eefA_REV_Hypoxia.r2 eefA_REV_Hypoxia.r3
## Afu8g05820            4.950019            5.108641            5.679440
## Afu1g00220            9.171863            9.198001            9.060365
## Afu1g11050            5.215491            4.860740            5.359741
##            EVOL_Normoxia.r1 EVOL_Normoxia.r2 EVOL_Normoxia.r3
## Afu8g05820         5.706065         5.761864         5.946817
## Afu1g00220         8.661995         8.692220         8.359535
## Afu1g11050         5.317572         5.046636         5.496991
##            EVOL_Hypoxia.r1 EVOL_Hypoxia.r2 EVOL_Hypoxia.r3
## Afu8g05820        5.010473        4.620046        5.579350
## Afu1g00220        9.886974        9.848927        9.664264
## Afu1g11050        5.306967        5.381549        5.652347
##            AF293_Normoxia.r1 AF293_Normoxia.r2 AF293_Normoxia.r3
## Afu8g05820          5.134334          5.518898          5.227872
## Afu1g00220          9.450351          9.156357          9.282708
## Afu1g11050          4.707125          4.749767          4.923155
##            AF293_Hypoxia.r1 AF293_Hypoxia.r2 AF293_Hypoxia.r3
## Afu8g05820         4.519403         4.822512         4.957699
## Afu1g00220         9.366595         9.258235         9.103386
## Afu1g11050         5.463004         4.900635         4.844617
##            Delta_eefA_AF293_Normoxia.r1 Delta_eefA_AF293_Normoxia.r2
## Afu8g05820                     5.412945                     5.549422
## Afu1g00220                     9.537580                     9.657085
## Afu1g11050                     4.557937                     4.666003
##            Delta_eefA_AF293_Normoxia.r3 Delta_eefA_AF293_Hypoxia.r1
## Afu8g05820                     5.512032                    4.570053
## Afu1g00220                     9.607869                    9.344747
## Afu1g11050                     4.463115                    5.138416
##            Delta_eefA_AF293_Hypoxia.r2 Delta_eefA_AF293_Hypoxia.r3
## Afu8g05820                    5.300729                    5.322912
## Afu1g00220                    9.161244                    9.325047
## Afu1g11050                    4.958216                    5.600279
##            eefA_OE_Normoxia.r1 eefA_OE_Normoxia.r2 eefA_OE_Normoxia.r3
## Afu8g05820            5.533940            5.299666            5.770554
## Afu1g00220            8.812538            8.773274            8.718402
## Afu1g11050            4.644813            4.612889            4.520274
##            eefA_OE_Hypoxia.r1 eefA_OE_Hypoxia.r2 eefA_OE_Hypoxia.r3
## Afu8g05820           4.554732           4.111874           4.446341
## Afu1g00220           9.303584           9.275212           9.050948
## Afu1g11050           5.211151           4.481174           4.965007
##            eefA_REV_Normoxia.r1 eefA_REV_Normoxia.r2 eefA_REV_Normoxia.r3
## Afu8g05820             5.436646             5.339726             5.386414
## Afu1g00220             8.638141             8.603246             8.580014
## Afu1g11050             4.513377             4.636187             4.003186
##            eefA_REV_Hypoxia.r1 eefA_REV_Hypoxia.r2 eefA_REV_Hypoxia.r3
## Afu8g05820            4.529399            4.701422            5.273547
## Afu1g00220            9.142116            9.164846            9.044947
## Afu1g11050            4.733895            4.375924            4.883589
##            EVOL_Normoxia.r1 EVOL_Normoxia.r2 EVOL_Normoxia.r3
## Afu8g05820         5.304344         5.360985         5.546657
## Afu1g00220         8.697143         8.723541         8.433151
## Afu1g11050         4.840706         4.544458         5.030288
##            EVOL_Hypoxia.r1 EVOL_Hypoxia.r2 EVOL_Hypoxia.r3
## Afu8g05820        4.587578        4.201434        5.169540
## Afu1g00220        9.766033        9.732401        9.571101
## Afu1g11050        4.827965        4.902749        5.172884

## Warning in design(object) == formula(~1): longer object length is not a
## multiple of shorter object length
## using pre-existing size factors
## estimating dispersions
## found already estimated dispersions, replacing these
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## Warning in design(object) == formula(~1): longer object length is not a
## multiple of shorter object length
## Warning in modelFormula == formula(~1): longer object length is not a
## multiple of shorter object length
## -- replacing outliers and refitting for 41 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## Warning in design(object) == formula(~1): longer object length is not a
## multiple of shorter object length

## Warning in design(object) == formula(~1): longer object length is not a
## multiple of shorter object length
## log2 fold change (MLE): condition Normoxia vs Hypoxia 
## Wald test p-value: condition Normoxia vs Hypoxia 
## DataFrame with 9932 rows and 6 columns
##                    baseMean     log2FoldChange             lfcSE
##                   <numeric>          <numeric>         <numeric>
## Afu8g05820  35.872486504032  0.769156128518177 0.138658472144817
## Afu1g00220 589.679004620398  -0.32638497706248 0.150495835650241
## Afu1g11050 28.8829103498098 -0.492600607666457  0.14750115957047
## Afu5g13370  158.37999870191   1.77425257689903 0.140757494477956
## Afu6g13800 1474.72793544823  -2.24151096947816 0.102977523044546
## ...                     ...                ...               ...
## Afu6g06700 108.212014468083    1.8310188038767 0.139445939351487
## Afu5g13780 59.0024937272377  0.662717147207926 0.123036222348646
## Afu1g10880 413.038759626856 -0.026689439401676 0.219301284101813
## Afu7g06170 19.3130076116073  -1.52262245870866 0.389184420007072
## Afu4g00830 43.4333053553617  -2.03159485229236 0.339042935008594
##                          stat                pvalue                  padj
##                     <numeric>             <numeric>             <numeric>
## Afu8g05820   5.54712681180316  2.90402122905489e-08  5.57670898046658e-08
## Afu1g00220   -2.1687309529349    0.0301031159881272    0.0390115015649894
## Afu1g11050  -3.33963888216832  0.000838873940719821   0.00124279474630508
## Afu5g13370   12.6050309681869  1.98094780582865e-36   1.1034645881935e-35
## Afu6g13800  -21.7669924776548 4.76915132838069e-105 1.94926794211839e-103
## ...                       ...                   ...                   ...
## Afu6g06700   13.1306713726632  2.19700027490564e-39  1.35700290611709e-38
## Afu5g13780   5.38635805421589  7.18996622910886e-08  1.35350160325074e-07
## Afu1g10880 -0.121702157426881     0.903134904561667     0.914366551692811
## Afu7g06170  -3.91234175993219  9.14054311505406e-05  0.000145022163288685
## Afu4g00830  -5.99214625203993  2.07089553101754e-09  4.19929244876811e-09
## log2 fold change (MLE): condition Normoxia vs Hypoxia 
## Wald test p-value: condition Normoxia vs Hypoxia 
## DataFrame with 9932 rows and 6 columns
##                    baseMean     log2FoldChange             lfcSE
##                   <numeric>          <numeric>         <numeric>
## Afu8g05820  35.872486504032  0.769156128518177 0.138658472144817
## Afu1g00220 589.679004620398  -0.32638497706248 0.150495835650241
## Afu1g11050 28.8829103498098 -0.492600607666457  0.14750115957047
## Afu5g13370  158.37999870191   1.77425257689903 0.140757494477956
## Afu6g13800 1474.72793544823  -2.24151096947816 0.102977523044546
## ...                     ...                ...               ...
## Afu6g06700 108.212014468083    1.8310188038767 0.139445939351487
## Afu5g13780 59.0024937272377  0.662717147207926 0.123036222348646
## Afu1g10880 413.038759626856 -0.026689439401676 0.219301284101813
## Afu7g06170 19.3130076116073  -1.52262245870866 0.389184420007072
## Afu4g00830 43.4333053553617  -2.03159485229236 0.339042935008594
##                          stat                pvalue                  padj
##                     <numeric>             <numeric>             <numeric>
## Afu8g05820   5.54712681180316  2.90402122905489e-08  5.57670898046658e-08
## Afu1g00220   -2.1687309529349    0.0301031159881272    0.0390115015649894
## Afu1g11050  -3.33963888216832  0.000838873940719821   0.00124279474630508
## Afu5g13370   12.6050309681869  1.98094780582865e-36   1.1034645881935e-35
## Afu6g13800  -21.7669924776548 4.76915132838069e-105 1.94926794211839e-103
## ...                       ...                   ...                   ...
## Afu6g06700   13.1306713726632  2.19700027490564e-39  1.35700290611709e-38
## Afu5g13780   5.38635805421589  7.18996622910886e-08  1.35350160325074e-07
## Afu1g10880 -0.121702157426881     0.903134904561667     0.914366551692811
## Afu7g06170  -3.91234175993219  9.14054311505406e-05  0.000145022163288685
## Afu4g00830  -5.99214625203993  2.07089553101754e-09  4.19929244876811e-09
## [1] "Intercept"                     "condition_Normoxia_vs_Hypoxia"
## using 'apeglm' for LFC shrinkage. If used in published research, please cite:
##     Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
##     sequence count data: removing the noise and preserving large differences.
##     bioRxiv. https://doi.org/10.1101/303255
## log2 fold change (MAP): condition Normoxia vs Hypoxia 
## Wald test p-value: condition Normoxia vs Hypoxia 
## DataFrame with 9932 rows and 5 columns
##                    baseMean      log2FoldChange             lfcSE
##                   <numeric>           <numeric>         <numeric>
## Afu8g05820  35.872486504032   0.758403901214331 0.137461142278937
## Afu1g00220 589.679004620398  -0.319493566124052 0.149087465253526
## Afu1g11050 28.8829103498098  -0.483657213971571 0.145469568503771
## Afu5g13370  158.37999870191    1.76092998967783 0.141385716877704
## Afu6g13800 1474.72793544823   -2.23461749424532  0.10305539871214
## ...                     ...                 ...               ...
## Afu6g06700 108.212014468083     1.8179462541189 0.139983678807195
## Afu5g13780 59.0024937272377   0.654921399819531 0.122570404367868
## Afu1g10880 413.038759626856 -0.0258530863370315 0.214438131526617
## Afu7g06170 19.3130076116073   -1.41760383734365 0.387669123213961
## Afu4g00830 43.4333053553617   -1.95429250176488 0.340710119598636
##                           pvalue                  padj
##                        <numeric>             <numeric>
## Afu8g05820  2.90402122905489e-08  5.57670898046658e-08
## Afu1g00220    0.0301031159881272    0.0390115015649894
## Afu1g11050  0.000838873940719821   0.00124279474630508
## Afu5g13370  1.98094780582865e-36   1.1034645881935e-35
## Afu6g13800 4.76915132838069e-105 1.94926794211839e-103
## ...                          ...                   ...
## Afu6g06700  2.19700027490564e-39  1.35700290611709e-38
## Afu5g13780  7.18996622910886e-08  1.35350160325074e-07
## Afu1g10880     0.903134904561667     0.914366551692811
## Afu7g06170  9.14054311505406e-05  0.000145022163288685
## Afu4g00830  2.07089553101754e-09  4.19929244876811e-09
## 
## out of 9932 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up)       : 3767, 38%
## LFC < 0 (down)     : 4254, 43%
## outliers [1]       : 0, 0%
## low counts [2]     : 0, 0%
## (mean count < 0)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
## 
## out of 9932 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up)       : 3768, 38%
## LFC < 0 (down)     : 4253, 43%
## outliers [1]       : 0, 0%
## low counts [2]     : 0, 0%
## (mean count < 0)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
## 
## out of 9932 with nonzero total read count
## adjusted p-value < 0.05
## LFC > 0 (up)       : 3663, 37%
## LFC < 0 (down)     : 4095, 41%
## outliers [1]       : 0, 0%
## low counts [2]     : 0, 0%
## (mean count < 0)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
## [1] 7229

{r pressure, echo=FALSE} #